package first;

import java.io.*;

public class LoginBean {
    private String  username;
    private String  password;
    private String  postbox;
    private String  fname;
    private String  sname;
    private String  department;
    private String  object;
    private  String url;

    public LoginBean() {}

    public String getUsername(){
        return username;
    }

    public void setUsername(String username){
        this.username=username;
    }

    public String getPassword(){ return password; }

    public void setPassword(String password){
        this.password=password;
    }

    public boolean Judge(String username,String password){

        File fread = new File("Student.txt");
        int flag=0;
        try {
            Reader in =new FileReader(fread);
            BufferedReader bufferRead =new BufferedReader(in);
            String str=null;
            String[] massege;
            while((str=bufferRead.readLine())!=null){
                massege=str.split(",");
                if(massege[0].equals(username)&&massege[1].equals(password)){
                    flag=1;
                    break;
                }
            }
            bufferRead.close();
            in.close();
        }
        catch(IOException e){
            System.out.println(e.toString());
        }

        if(flag==1) {
            return true;
        }
        else return false;

    }


}

